let fs = require('fs')

module.exports = {
    publicPath: './',
    configureWebpack: config => {
        config.resolve.alias['vue$'] = 'vue/dist/vue.esm.js'
        config.resolve.alias['assets'] = '@/assets'
        config.resolve.alias['components'] = '@/components'
        config.resolve.alias['views'] = '@/views'
        config.resolve.alias['services'] = '@/services'
        config.resolve.alias['core'] = '@/core'

        if (process.env.VUE_APP_ENV_TYPE === 'pre') {
            fs.writeFile('./public/static/url.js', 'var url = "http://yfb.gwm.com.cn:88"', 'utf8', () => {})
        } else if (process.env.VUE_APP_ENV_TYPE === 'uat') {
            fs.writeFile('./public/static/url.js', 'var url = "http://uat.gwm.com.cn"', 'utf8', () => {})
        } else if (process.env.VUE_APP_ENV_TYPE === 'pro') {
            fs.writeFile('./public/static/url.js', 'var url = "http://tsp_sub.gwm.com.cn"', 'utf8', () => {})
        } else {
            fs.writeFile('./public/static/url.js', 'var url = "http://yuntest.gwm.com.cn:86"', 'utf8', () => {})
        }
    },

    productionSourceMap: false
}
